package com.demo;

import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author liuyuan
 * @Date 2022/7/13 下午5:07
 * @Version 1.0
 */
public class 集合类 {
    public static void main(String[] args) {
//        ArrayList<String> arrs =  new ArrayList<>();
//        arrs.add("aa");
//        arrs.add("1");
//        arrs.add("true");
//        System.out.println(arrs.toString());
       Person person1 =  new Person();
        person1.setAge(19);
        person1.setName("张三");
        Person person2 =  new Person();
        person2.setAge(20);
        person2.setName("李四");
        Person person3 =  new Person();
        person3.setAge(22);
        person3.setName("王二");
       ArrayList<Person> arrayList =  new ArrayList<>();
       arrayList.add(person1);
       arrayList.add(person2);
       arrayList.add(person3);
       System.out.println(arrayList.toString());

        Map<String,Person> map = new HashMap<>();
        map.put("张三",person1);
        map.put("李四",person2);
        map.put("王二",person3);
        Person person = map.get("张三");
        System.out.println(map.toString());

    }
}
